<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 17-11-2
 * Time: 下午4:04
 */
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_connect($socket,'www.qq.com',80);

$remoteAddress = '';
$remotePort = 0;

socket_getpeername($socket,$remoteAddress,$remotePort);
var_dump($remoteAddress,$remotePort);